// src/App.jsx
import React from 'react';
import { BrowserRouter as Router, Routes, Route } from 'react-router-dom';
import { AppProvider } from './contexts/AppContext';
import { AuthProvider } from './contexts/AuthContext';
import Navbar from './components/layout/Navbar';
import BottomBar from './components/layout/BottomBar';
import Login from './components/auth/Login';
import Register from './components/auth/Register';
import TrackList from './components/racing/TrackList';
import TrackDetail from './components/racing/TrackDetail';
import VehicleList from './components/racing/VehicleList';
import Payment from './components/racing/Payment';
import ChallengeList from './components/challenge/ChallengeList';
import Rankings from './components/challenge/Rankings';
import ForumHome from './components/forum/ForumHome';
import Calendar from './components/calendar/Calendar';
import Profile from './components/profile/Profile';

function App() {
  return (
    <Router>
      <AuthProvider>
        <AppProvider>
          <div className="min-h-screen bg-gray-100">
            <Navbar />
            <main className="container mx-auto px-4 pb-16 pt-16">
              <Routes>
                <Route path="/" element={<TrackList />} />
                <Route path="/login" element={<Login />} />
                <Route path="/register" element={<Register />} />
                <Route path="/tracks/:id" element={<TrackDetail />} />
                <Route path="/vehicles" element={<VehicleList />} />
                <Route path="/payment" element={<Payment />} />
                <Route path="/challenges" element={<ChallengeList />} />
                <Route path="/rankings" element={<Rankings />} />
                <Route path="/forum" element={<ForumHome />} />
                <Route path="/calendar" element={<Calendar />} />
                <Route path="/profile" element={<Profile />} />
              </Routes>
            </main>
            <BottomBar />
          </div>
        </AppProvider>
      </AuthProvider>
    </Router>
  );
}

export default App;